﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Threading.Tasks;

namespace JWTClient.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [Authorize]
    public class AuthTestController : ControllerBase
    {
        [HttpGet("GetCurrentTime")]
        public JsonResult GetCurrentTime()
        {

            return new JsonResult(from c in User.Claims select new { c.Type, c.Value });
            //var sub = User.FindFirst(d => d.Type == JwtRegisteredClaimNames.Sub)?.Value;
            //return DateTime.Now.ToString("yyyy-MM-dd");
        }
    }
}
